//打开页面，带页面关闭回调
var openPageEndIndex = 0;

function openPageEnd(url, callBack) {
    openPageEndIndex = layer.open({
        type: 1,
        area: ['80%', '95%'],
        fixed: false, //不固定
        scrollbar: false,
        title: "<strong class='text-muted'>添加接口</strong>",
        shadeClose: true,
        content: url,
        end: callBack
    })
}

//异步调用，返回json内容
function ajaxFunParam(url, data, callBack) {
    $.ajax({
        url: url,
        type: "post",
        data: data,
        dataType: "json",
        success: callBack,
        error: function () {
            console.log('操作失败')
        }
    });
}

//同步调用
function ajaxSyncFunParam(url, data, callBack) {
    $.ajax({
        url: url,
        type: "post",
        data: data,
        dataType: "json",
        success: callBack,
        async: false,
        error: function () {
            console.log('操作失败')
        }
    });
}

//异步调用，返回html内容
function ajaxFunParamText(url, data, callBack) {
    $.ajax({
        url: url,
        type: "post",
        data: data,
        dataType: "text",
        success: callBack,
        error: function () {
            console.log('操作失败')
        }
    });
}

//登录窗口
var loginWindowIndex = 0;

function loginWindow(url) {
    loginWindowIndex = layer.open({
        type: 1,
        area: ['30%', '35%'],
        fixed: false, //不固定
        scrollbar: false,
        title: "<strong class='text-muted'>用户登录</strong>",
        // closeBtn: false,
        shadeClose: true,
        content: url,
    })
}

//提示,有回调
function msgFunCallBack(msg, callBack) {
    layer.msg(msg, {
        time: 1000,
        // offset: 't',
    }, callBack)
}

//提示，无回调
function msgFun(msg) {
    layer.msg(msg, {
        time: 1000,
        // offset: 't',
    })
}

//删除方法，带参数
function delFun(url, param, callBack) {
    layer.confirm('是否删除？', {
        btn: ['是', '否'] //按钮
    }, function () {
        ajaxFunParam(url, param, callBack)
    });
}

//关闭页面
function closePage(index) {
    layer.close(index); //再执行关闭
}

// n
// t
// s
// f
// m
// hm